Skip to content

Conversation

@kate-goldenring
Copy link
Contributor

Draft until support for executing only a set of components is merged in the shim: spinframework/containerd-shim-spin#197

Spin changes: spinframework/spin#2826.

Copy link
Contributor

@calebschoepp calebschoepp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking for a few cleanup things but I think this is on the right track!

@kate-goldenring
Copy link
Contributor Author

@calebschoep CI is failing with:

redis_test.go:165: Failed to create spinapp: admission webhook "vspinapp.kb.io" denied the request: SpinApp.core.spinoperator.dev "test-spintainer-redis" is invalid: spec.executor: Invalid value: "spintainer": executor does not exist in namespace

Copy link
Contributor

@calebschoepp calebschoepp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for addressing those comments!

@calebschoepp calebschoepp dismissed their stale review October 22, 2024 19:42

No longer relevant

@calebschoepp
Copy link
Contributor

@calebschoep CI is failing with:

redis_test.go:165: Failed to create spinapp: admission webhook "vspinapp.kb.io" denied the request: SpinApp.core.spinoperator.dev "test-spintainer-redis" is invalid: spec.executor: Invalid value: "spintainer": executor does not exist in namespace

I re-ran the test and it passed. Looks like flakiness? Not sure why it would be flaky though b/c we always make sure the executor is set before referencing it.

strategy:
matrix:
app: [cpu-load-gen, hello-world, outbound-http, variabletester, redis-sample]
app: [cpu-load-gen, hello-world, outbound-http, variabletester, redis-sample, salutations]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lol love the app name

```shell
k3d cluster create wasm-cluster \
--image ghcr.io/spinkube/containerd-shim-spin/k3d:v0.15.1 \
--image ghcr.io/spinkube/containerd-shim-spin/k3d:v0.16.0 \
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wonder how we can keep this updated automagically

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe we start pushing a latest tag?

@michelleN
Copy link
Contributor

michelleN commented Oct 23, 2024

Could we add an e2e for this (or an issue) as a follow up task once shim changes are merged?

@kate-goldenring
Copy link
Contributor Author

Could we add an e2e for this (or an issue) as a follow up task

@michelleN sure. I'll add that as a follow up and use it as an opportunity to update the image reference to one in the spinkube GHCR

@kate-goldenring
Copy link
Contributor Author

@michelleN @endocrimes @calebschoepp feel free to merge whenever appropriate. I don't have perms

@kate-goldenring
Copy link
Contributor Author

kate-goldenring commented Oct 23, 2024

@calebschoepp @michelleN @endocrimes I realized i need to add support to Spintainer executor as well but adding the component-id flags to the container args. I'll also follow this up with a draft PR of that because this functionality isn't available in a released version of Spin -- it'll be coming in Spin 3.0. It'll just be the following:

diff --git a/internal/controller/spinapp_controller.go b/internal/controller/spinapp_controller.go
index f3e3ff3..66dbe78 100644
--- a/internal/controller/spinapp_controller.go
+++ b/internal/controller/spinapp_controller.go
@@ -461,10 +461,16 @@ func constructDeployment(ctx context.Context, app *spinv1alpha1.SpinApp, config
 			ReadinessProbe: readinessProbe,
 		}
 	} else if config.SpinImage != nil {
+		components_flag := ""
+		if app.Spec.Components != nil {
+			for _, component := range app.Spec.Components {
+				components_flag = fmt.Sprintf("--component_id=%s", component)
+			}
+		}
 		container = corev1.Container{
 			Name:  app.Name,
 			Image: *config.SpinImage,
-			Args:  []string{"up", "--listen", fmt.Sprintf("0.0.0.0:%d", spinapp.DefaultHTTPPort), "-f", app.Spec.Image, "--runtime-config-file", "/runtime-config.toml"},
+			Args:  []string{"up", "--listen", fmt.Sprintf("0.0.0.0:%d", spinapp.DefaultHTTPPort), "-f", app.Spec.Image, "--runtime-config-file", "/runtime-config.toml", components_flag},
 			Ports: []corev1.ContainerPort{{
 				Name:          spinapp.HTTPPortName,
 				ContainerPort: spinapp.DefaultHTTPPort,

@kate-goldenring
Copy link
Contributor Author

Added test here: #328

@michelleN michelleN merged commit 9668cab into spinframework:main Oct 24, 2024
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants